import java.lang.*;
import org.kwis.msp.lcdui.Jlet;
import org.kwis.msp.lcdui.Display;

import org.kwis.msp.lwc.ShellComponent   ;
import org.kwis.msp.lwc.TextComponent   ;
import org.kwis.msp.lwc.TextBoxComponent   ;
import org.kwis.msp.lwc.TextFieldComponent;
import org.kwis.msp.lwc.FormComponent   ;
import org.kwis.msp.lwc.LabelComponent;

public class TextBoxComponentEx1 extends Jlet{

	Display displayLCD ;
	ShellComponent shell;	

	public TextBoxComponentEx1(){  
		displayLCD = Display.getDefaultDisplay();
		shell = new ShellComponent();
	}

	protected void startApp(String[] arg0){
		
		displayLCD = Display.getDefaultDisplay();

		FormComponent form = new FormComponent();

		TextBoxComponent textBox = new TextBoxComponent("ABCDE", TextComponent.CONSTRAINT_ANY);

			char [] inCHAR = new char[8];
			char ch = 'a';
			for(int i=0; i<8;i++){ inCHAR[i]=ch++; }
			
	
		textBox.insert(inCHAR,3,4,2);

		int textLength = (textBox.getString()).length();
		
		LabelComponent labelPre = new LabelComponent("  "+textBox.getString());

		textBox.delete(textLength-2,2);

		LabelComponent labelPost = new LabelComponent("  "+textBox.getString());

		
		TextFieldComponent textField = new TextFieldComponent("",TextComponent.CONSTRAINT_ANY);

		LabelComponent labelTextBox = new LabelComponent("TextBoxComponent");
		LabelComponent labelTextField = new LabelComponent("TextFieldComponent");
		
		form.addComponent(labelTextBox);
		form.addComponent(textBox);
		form.addComponent(labelPre);
		form.addComponent(labelPost);

		form.addComponent(labelTextField);
		form.addComponent(textField);

		shell.setTitle("TextBox & TextField");
		shell.setWorkComponent(form);

		displayLCD.pushCard(shell.getCard());


		
	}
	protected void destroyApp(boolean arg0) {  }

	

}
